package cn.legend.travel.guide.dao.persist.repository.impl;

import cn.legend.travel.guide.dao.persist.mapper.GuideMapper;
import cn.legend.travel.guide.dao.persist.repository.IGuideRepository;
import cn.legend.travel.guide.pojo.po.GuidePO;
import cn.legend.travel.guide.pojo.vo.GuideVO;
import cn.legend.travel.guide.util.GuidePOListToGuideVOConvertor;
import cn.legend.travel.guide.util.GuidePOListToMapConvertor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
public class GuideRepositoryImpl implements IGuideRepository {
    @Autowired
    GuideMapper guideMapper;
    @Value("${legend.dao.default-query-page-size}")
    private Integer pageSize;
    @Override
    public List<Map<String, Object>> getGuideList(Integer pageNum) {
        Integer offSet = (pageNum-1)*pageSize;
        List<GuidePO> guideList = guideMapper.getGuideList(offSet,pageSize);
        return  GuidePOListToMapConvertor.convert(guideList);
    }
}
